import {
  IsEnum,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString
} from 'class-validator'

export class CreateMenuDto {
  @IsOptional()
  parentId: number

  @IsString()
  name: string

  @IsString()
  zhName: string

  @IsString()
  path: string

  @IsString()
  component: string

  @IsOptional()
  description: string

  @IsOptional()
  icon: string

  @IsOptional()
  order: number
}

export enum PermissionType {
  GET = 'get',
  POST = 'post',
  DELETE = 'delete',
  PATCH = 'patch'
}
export class CreateMenuPermissionDto {
  @IsNotEmpty()
  menuId: number

  @IsOptional()
  @IsString()
  name: string

  @IsNotEmpty()
  @IsString()
  permission: string

  @IsNotEmpty()
  @IsEnum(PermissionType)
  type: PermissionType

  @IsOptional()
  @IsString()
  description: string
}
